package com.unit.handler;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateHandler implements DataObjectHandler {

	SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	
	@Override
	public Object convert(String data, Class<?> propType) {
		if(Date.class.equals(propType)) {
			try {
				return df.parse(data);
			} catch (ParseException e) {
				throw new RuntimeException("Date时间格式转换异常："+e.getMessage());
			}
		}
		return null;
	}

}
